unit newResourceForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TnewResourceScreen = class(TForm)
    Panel1: TPanel;
    Label1: TLabel;
    nameEdit: TEdit;
    Button1: TButton;
    procedure FormShow(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure nameEditKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  newResourceScreen: TnewResourceScreen;

implementation

uses globals, workNode, mainScreen;

{$R *.dfm}

procedure TnewResourceScreen.FormShow(Sender: TObject);
begin
nameEdit.Text := 'Resource-'+IntToStr(globalView.resList.Items.Count);
end;

procedure TnewResourceScreen.Button1Click(Sender: TObject);
var
  wn : baseClassData;
  i : Integer;
begin
wn := baseClassData.Create(nameEdit.Text, '', '', '', 0, RESOURCE_TYPE);
Resources_DataList.Add(wn);
i := globalView.resList.Items.Add(wn.get_Name);
globalView.resList.State[i] := cbUnchecked;
close;
end;

procedure TnewResourceScreen.nameEditKeyPress(Sender: TObject; var Key: Char);
begin
if Key = char(13) then // for enter
  Button1Click(nil);
end;

end.
